package pl.peterjack.model.jdo;

import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.http.HttpServletRequest;

import com.google.appengine.api.datastore.Key;

import pl.peterjack.model.PMF;
import pl.peterjack.model.dane.Firma;
import pl.peterjack.model.dane.Klient;

public class KlientJDO {

	@SuppressWarnings("unchecked")
	public static List<Klient> getKlienciFirmy(Firma firma) {
		PersistenceManager pm = PMF.get().getPersistenceManager();
		List<Klient> results = null;
	    Query query = pm.newQuery(Klient.class, "firma == firmaPodana");
		query.declareParameters(Key.class.getName() + " firmaPodana");
		results = (List<Klient>) query.execute(firma.getId());
		for(Klient k:results) {
			k.setHaslo(""); 
		}
		return results;
	}
}
